<template>
  <div>
    <!-- 由于有三个组件，使用布尔值无法胜任三个组件之间的切换功能，因此此处使用数字 -->
    <CategorySelector class="mb-20" :disabled="isShow !== 1" />
    <SpuList v-if="isShow === 1" @setIsShow="setIsShow" />
    <AddOrUpdateSpu v-else-if="isShow === 2" @setIsShow="setIsShow" />
    <AddSku v-else @setIsShow="setIsShow"/>
  </div>
</template>

<script lang="ts">
export default {
  name: "XSpu",
};
</script>

<script lang="ts" setup>
import { ref } from "vue";
import SpuList from "./components/spuList/index.vue";
import AddOrUpdateSpu from "./components/addOrUpdateSpu/index.vue";
import CategorySelector from "@/components/CategorySelector/index.vue";
import AddSku from "./components/addSku/index.vue";
const isShow = ref(1);

const setIsShow = (showValue: number) => {
  isShow.value = showValue;
};
</script>

<style scoped></style>
